import java.util.List;

public class Test {
    public void addLast(int data){
        ListNode node=new ListNode(data);
        if(head==null){
            head=node;
            return;
        }
        ListNode cur=head; //让cur从头head开始遍历
        while (cur.next!=null){
                cur=cur.next;
        }
        cur.next=node;
    }
}
